# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=ruby-prime
_gemname=${pkgname#ruby-}
pkgver=0.1.2
pkgrel=5
pkgdesc='Prime numbers and factorization library.'
arch=('any')
url='https://github.com/ruby/prime'
license=('BSD')
depends=('ruby' 'ruby-forwardable' 'ruby-singleton')
source=("https://rubygems.org/downloads/$_gemname-$pkgver.gem")
noextract=("$_gemname-$pkgver.gem")
sha512sums=('43eacba6f3de6d3f384de7da985a5b062a3caf72bf4b4283d0a60772b6d73ce6f88f3faa85696070f646c0e87cb1ab728e409d11168a30103f1964d9aee06fad')

package() {
  _gemdir="$(ruby -e'puts Gem.default_dir')"

  gem install --ignore-dependencies --no-user-install --no-document \
    -i "$pkgdir/$_gemdir" -n "$pkgdir/usr/bin" "$_gemname-$pkgver.gem"

  rm "$pkgdir/$_gemdir/cache/$_gemname-$pkgver.gem"

  find "$pkgdir/$_gemdir/extensions/" -name *.so -delete
}

